package memory

import "fmt"

// StoreType represents the type of memory store
type StoreType string

const (
	StoreTypeInMemory StoreType = "inmemory"
	StoreTypeRedis    StoreType = "redis"
)

// CreateMemoryStore creates a new memory store
func CreateMemoryStore(config *MemoryConfig) (MemoryStore, error) {
	switch StoreType(config.Type) {
	case StoreTypeInMemory:
		return NewInMemoryStore(), nil
	case StoreTypeRedis:
		return NewRedisStore(config)
	default:
		return nil, fmt.Errorf("unsupported store type: %s", config.Type)
	}
}

// NewMemoryManager creates a new memory manager based on config
func NewMemoryManager(config *MemoryConfig) (MemoryManager, error) {
	switch config.Type {
	case "inmemory":
		return NewInMemoryManager(), nil
	default:
		return nil, fmt.Errorf("unsupported memory type: %s", config.Type)
	}
}
